<?php
/**
 * Created by JetBrains PhpStorm.
 * User: zhouyang
 * Date: 13-7-15
 * Time: 下午4:31
 * To change this template use File | Settings | File Templates.
 */
class TagHasNewsModel  extends Model{

    //检查信息是否已经添加
    public function getTagHasNews($tag_id,$new_id){
        $row = $this->dbreader()->getTagHasNews($tag_id,$new_id);
        return $row;
    }

    //添加 tag 拥有的 new 信息
    public function addTagHasNews($tag_id,$new_id){

        $ret = $this->getTagHasNews($tag_id,$new_id);

        if(empty($ret)){
            $ret = $this->dbreader()->addTagHasNews($tag_id,$new_id);
        }

        return $ret;
    }

    //删除 tag_id 对应的信息
    public function delByTagId($tag_id){
        $ret = $this->dbreader()->delByTagId($tag_id);

        return $ret;
    }

    //删除 new_id 对应的信息
    public function delByNewId($new_id){
        $ret = $this->dbreader()->delByNewId($new_id);

        return $ret;
    }

    //删除 new_id and tag_id 对应的信息
    public function delByNewIDAndTagID($new_id,$tag_id){
        $ret = $this->dbreader()->delByNewIDAndTagID($new_id,$tag_id);

        return $ret;
    }
}